package com.demo10;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateFormatDemo {
    public static void main(String[] args) throws ParseException {
        //定义一个日期类
        Date d1 = new Date();

        //调用方法转字符串
        String string = DateUtils.dateToString(d1, "YYYY-MM-dd HH:mm:ss");

        System.out.println("当前日期是:"+string);

        String string1 = DateUtils.dateToString(d1, "YYYY年MM月dd日");

        System.out.println("日期是:"+string1);


        Date date = DateUtils.stringToDate("2023-10-10", "YYYY-MM-dd");

        System.out.println("显示日期信息"+date);
    }
}
